#include <iostream>
#include <algorithm>

using std::cout;
using std::endl;
using std::begin;
using std::end;
using std::for_each;

int main()
{
    int array[] = {1, 2, 3, 4, 5};
    int num = 3;

    auto printBigger = [=](const int a) {
        if (a > num) {
            cout << a << endl;
        }
    };
    
    for_each(begin(array), end(array), printBigger);

    return 0;
}
